#include<stdio.h>
#include<stdlib.h>
struct st
{
	int date[1005];
	int front, rear;
};
typedef struct st* Qnode;
typedef Qnode queue;
int main()
{
	int n;
	scanf_s("%d", &n);
	queue q1, q2;
	q1 = (queue)malloc(sizeof(st));
	q2 = (queue)malloc(sizeof(st));
	q1->rear = q2->rear = q1->front = q2->front = 0;
	while (n--)
	{
		int m;
		scanf_s("%d", &m);
		if (m % 2) {
			q1->date[q1->rear] = m;
			q1->rear++;
		}
		else {
			q2->date[q2->rear] = m;
			q2->rear++;
		}
	}
	while (q1->front != q1->rear)
	{
		int cnt = 2, i = 0;
		while (cnt-- && q1->front != q1->rear) {
			if (i++) printf(" ");
			printf("%d", q1->date[q1->front]);
			q1->front++;
		}
		if (q2->front != q2->rear) {
			printf(" %d ", q2->date[q2->front]);
			q2->front++;
		}
	}
	int cnt = 0;
	while (q2->rear != q2->front) {
		if (cnt++) printf(" ");
		printf("%d", q2->date[q2->front]);
		q2->front++;
	}
	return 0;
}